package cn.jhz.filesharingsystem.util;

public class HeadersUtil {
	//static private final String[] agent = { "Android", "iPhone", "iPod","iPad", "Windows Phone", "MQQBrowser" }; //定义移动端请求的所有可能类型

	/**
	 * 判断User-Agent 是不是来自于手机
	 * 
	 * @param ua
	 * @return
	 */
	public static boolean checkAgentIsMobile(String ua) {
			String []types = ua.replaceAll("[(;)]", "").split(" ");
				for (String type : types) {
					switch (type) {
					case "Android":	
					case "iPhone":
					case "iPod":
					case "iPad":
					case "Windows Phone":
					case "MQQBrowser":
						return true;
					case "Windows":
					case "Macintosh":
						return false;
					default:
						break;
					}
				}	
		return false;
	}
}
